Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Stabilize APIs for the 1.11.0 release #34530

Merged
merged 1 commit into from
Jul 4, 2016

Conversation

alexcrichton
Copy link
Member

Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.

Stable

  • BTreeMap::{append, split_off}
  • BTreeSet::{append, split_off}
  • Cell::get_mut
  • RefCell::get_mut
  • BinaryHeap::append
  • {f32, f64}::{to_degrees, to_radians} - libcore stabilizations mirroring past
    libstd stabilizations
  • Iterator::sum
  • Iterator::product

Deprecated

  • {f32, f64}::next_after
  • {f32, f64}::integer_decode
  • {f32, f64}::ldexp
  • {f32, f64}::frexp
  • num::One
  • num::Zero

Added APIs (all unstable)

  • iter::Sum
  • iter::Product
  • iter::Step - a few methods were added to accomodate deprecation of One/Zero

Removed APIs

  • From<Range<T>> for RangeInclusive<T> - everything about RangeInclusive is
    unstable

Closes #27739
Closes #27752
Closes #32526
Closes #33444
Closes #34152
cc #34529 (new tracking issue)

@rust-highfive
Copy link
Collaborator

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

cc @rust-lang/libs, the deprecation of Zero and One had some particularly nasty fallout, but not totally unreasonable. The Step trait is getting farther and farther away from stabilization though in the implementation of iteration for a few range types.

@brson
Copy link
Contributor

brson commented Jun 28, 2016

@alexcrichton Your comments about the fallout and unlikelihood of stabilizing Step are worrying. Are we digging ourselves into a hole with these unstable traits that stable APIs depend on? Are you still confident about stabilizing sum/product (sorry to keep harping on this)?

@alexcrichton
Copy link
Member Author

I'm personally still confident in stabilizing the sum/product methods, but yes we're digging ourselves into a hole with Step and the various iterator implementations it's used for. I believe step_by is still unstable but it's used for the iterators on Range and RangeFrom, which are indeed stable.

The methods of Step used by the stable impl blocks are very small and minor (one could easily see stabilizing that triat). So I'm not as un-confident now that I read into it.

This would entail killing step_by and rethinking RangeInclusive iteration, however.

@alexcrichton alexcrichton force-pushed the stabilize-1.11 branch 2 times, most recently from e0aa055 to 71dec1b Compare June 28, 2016 20:17
impl Sum for $a {
fn sum<I: Iterator<Item=$a>>(iter: I) -> $a {
iter.fold(0, |a, b| {
a.checked_add(b).expect("overflow in sum")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why always check rather than use + with its configurable behavior?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With MIR we unfortunately don't have that luxury as whether the arithmetic is checked or not is encoded into the MIR, not generated at trans time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that relevant because libcore is usually distributed pre-compiled? If so it’s worth a source comment at least, and maybe a doc-comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overflow behavior is documented on the sum/product methods, and yes this is due to it being distributed as a compiled artifact.

@aturon
Copy link
Member

aturon commented Jul 1, 2016

One stability nit, otherwise r=me

@alexcrichton
Copy link
Member Author

@bors: r=aturon

@bors
Copy link
Contributor

bors commented Jul 1, 2016

📌 Commit 71dec1b has been approved by aturon

@bors
Copy link
Contributor

bors commented Jul 2, 2016

⌛ Testing commit 71dec1b with merge 9ef8ff8...

@bors
Copy link
Contributor

bors commented Jul 2, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@arielb1
Copy link
Contributor

arielb1 commented Jul 2, 2016

> C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\iter\range.rs:207:17: 207:26 error: comparison is useless due to type limits
> C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\iter\range.rs:207                 *self < 0
> C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\iter\range.rs:247:1: 247:32 note: in this expansion of step_impl_no_between! (defined in C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\iter\range.rs)
> C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\lib.rs:60:31: 60:39 note: lint level defined here
> C:\bot\slave\auto-win-gnu-32-opt-rustbuild\build\src\libcore\lib.rs:60 #![cfg_attr(not(stage0), deny(warnings))]

@alexcrichton
Copy link
Member Author

@bors: r=aturon

@bors
Copy link
Contributor

bors commented Jul 2, 2016

📌 Commit 7cfcb4a has been approved by aturon

@bors
Copy link
Contributor

bors commented Jul 2, 2016

⌛ Testing commit 7cfcb4a with merge f632159...

@bors
Copy link
Contributor

bors commented Jul 2, 2016

💔 Test failed - auto-win-msvc-64-cargotest

@arielb1
Copy link
Contributor

arielb1 commented Jul 3, 2016

C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\num/f32.rs:114:26: 114:36 error: use of deprecated item: never really came to fruition and easily implementable outside the standard library
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\num/f32.rs:114             let (a, b) = f64::frexp(x as f64);
                                                                                                 ^~~~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]
                                                                                                  ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\num/f32.rs:121:13: 121:23 error: use of deprecated item: never really came to fruition and easily implementable outside the standard library
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\num/f32.rs:121             f64::ldexp(x as f64, n as isize) as c_float
                                                                                    ^~~~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]
                                                                                                  ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:17:5: 17:14 error: use of deprecated item: no longer used for Iterator::sum
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:17 use num::Zero;
                                                                                   ^~~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]
                                                                                                  ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows\net.rs:20:5: 20:13 error: unused import
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows\net.rs:20 use ops::Neg;
                                                                                   ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]
                                                                                                  ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:181:23: 181:27 error: use of deprecated item: no longer used for Iterator::sum
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:181 fn cvt<I: PartialEq + Zero>(i: I) -> io::Result<I> {
                                                                                                      ^~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]
                                                                                                  ^~~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:182:13: 182:20 error: use of deprecated item: no longer used for Iterator::sum
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\sys/windows/mod.rs:182     if i == I::zero() {
                                                                                            ^~~~~~~
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289:31: 289:39 note: lint level defined here
C:\bot\slave\auto-win-msvc-64-cargotest\build\src\libstd\lib.rs:289 #![cfg_attr(not(stage0), deny(warnings))]

Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.

Stable

* `BTreeMap::{append, split_off}`
* `BTreeSet::{append, split_off}`
* `Cell::get_mut`
* `RefCell::get_mut`
* `BinaryHeap::append`
* `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past
  libstd stabilizations
* `Iterator::sum`
* `Iterator::product`

Deprecated

* `{f32, f64}::next_after`
* `{f32, f64}::integer_decode`
* `{f32, f64}::ldexp`
* `{f32, f64}::frexp`
* `num::One`
* `num::Zero`

Added APIs (all unstable)

* `iter::Sum`
* `iter::Product`
* `iter::Step` - a few methods were added to accomodate deprecation of One/Zero

Removed APIs

* `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is
  unstable

Closes rust-lang#27739
Closes rust-lang#27752
Closes rust-lang#32526
Closes rust-lang#33444
Closes rust-lang#34152
cc rust-lang#34529 (new tracking issue)
@alexcrichton
Copy link
Member Author

@bors: r=aturon

@bors
Copy link
Contributor

bors commented Jul 3, 2016

📌 Commit 3016626 has been approved by aturon

@bors
Copy link
Contributor

bors commented Jul 3, 2016

⌛ Testing commit 3016626 with merge 696b703...

bors added a commit that referenced this pull request Jul 3, 2016
std: Stabilize APIs for the 1.11.0 release

Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.

Stable

* `BTreeMap::{append, split_off}`
* `BTreeSet::{append, split_off}`
* `Cell::get_mut`
* `RefCell::get_mut`
* `BinaryHeap::append`
* `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past
  libstd stabilizations
* `Iterator::sum`
* `Iterator::product`

Deprecated

* `{f32, f64}::next_after`
* `{f32, f64}::integer_decode`
* `{f32, f64}::ldexp`
* `{f32, f64}::frexp`
* `num::One`
* `num::Zero`

Added APIs (all unstable)

* `iter::Sum`
* `iter::Product`
* `iter::Step` - a few methods were added to accomodate deprecation of One/Zero

Removed APIs

* `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is
  unstable

Closes #27739
Closes #27752
Closes #32526
Closes #33444
Closes #34152
cc #34529 (new tracking issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants